/*********************************************************************************************************/
* REGRESSIONS
/*********************************************************************************************************/

clear all
cls
set more off, permanently

/*********************************************************************************************************/

/* Here you should cd to your root directory and all other paths are then set relative to this  */
cd "/Users/paul/Dropbox/Research/Boyarchenko/ON_ID_Returns/0_codes/Version5.0_public_v3/04_Stata_codes"

global dtas "../03_DTAs"
global temp "temp"
/*********************************************************************************************************/
/*********************************************************************************************************/

use $dtas/Regressions_Paper_DST_Asia_RSV

/*********************************************************************************************************/
/*********************************************************************************************************/

describe
xtset date period 

gen Lag17_RSV = RSV[_n-17]
gen Lag16_RSV = RSV[_n-16]
gen Lag15_RSV = RSV[_n-15]
gen Lag14_RSV = RSV[_n-14]
gen Lag13_RSV = RSV[_n-13]
gen Lag12_RSV = RSV[_n-12]
gen Lag11_RSV = RSV[_n-11]
gen Lag10_RSV = RSV[_n-10]
gen Lag9_RSV = RSV[_n-9]
gen Lag8_RSV = RSV[_n-8]
gen Lag7_RSV = RSV[_n-7]
gen Lag6_RSV = RSV[_n-6]
gen Lag5_RSV = RSV[_n-5]
gen Lag4_RSV = RSV[_n-4]
gen Lag3_RSV = RSV[_n-3]
gen Lag2_RSV = RSV[_n-2]
gen Lag1_RSV = RSV[_n-1]

gen RETURNS = Ret*10000
gen DST = dummy

   
/*********************************************************************************************************/

* REGRESSION: Rets on closing RSV

est clear

foreach i in 1 2 3 4 5{

	cap drop temp1
	cap drop temp2
	gen temp1=Lag`i'_RSV
	gen temp2=DST*temp1
	
	qui: eststo: reg RETURNS temp1 DST temp2 if period==`i', rob cluster(month)
	estadd scalar R=100*(e(r2))
	estadd scalar Nobs=e(N)
	
}

esttab, nostar nonumbers mtitles("18-19" "19-20" "20-21" "21-22" "22-23")   


/*********************************************************************************************************/
